<?php
/**
 * DynaGrid - The PHP datagrid
 *
 * @package    DynaGrid
 * @author     $Author: keesschepers $
 * @version    $Id: Column.php 15 2011-02-15 17:07:57Z keesschepers $
 */

include_once 'HTML/Table/Column/Header.php';
include_once 'HTML/Table/Column/Footer.php';
include_once 'HTML/Table/Column/Body.php';

/**
 * Basic definition for a table column which can be a tbody, thead or a tfooter column.
 */
abstract class DynaGrid_HTML_Table_Column extends DynaGrid_HTML_Abstract {
	/**
	 * Name of the column (internal used)
	 *
	 * @var string
	 */
	protected $name;	
	public function __construct($name) {
		$this->name = $name;
	}
	static function factory($name,$part) {
		$className = 'DynaGrid_HTML_Table_Column_'.ucfirst($part);
		if(class_exists($className)) {
			return new $className($name);
		} else {
			throw new DynaGrid_Exception('Cannot find for column part: '.$className);
		}
	}
	public function __get($key) {
		switch ($key) {
			case 'name' :
				return $this->name;
			default :
				throw new DynaGrid_Exception('Uknown column property ('.$key.')');
		}
	}
}